## Handling of Channels, Traces and Diagram Areas

The following examples show you how to perform basic tasks related to channel and trace definition and to the display of traces in diagram areas.

Creating several traces with equal channel settings

Creating traces with different channel settings

Defining markers and limit lines

All example programs in this section have been developed and tested by means of the GPIB Explorer
provided with the network analyzer. No extra programming environment is needed.

### Several Traces with Equal Channel Settings

Programming task: Create up to four different traces with equal channel settings, assign the four 2-port standard S-parameters to the traces and display them in up to four diagram areas.

Important remote control features for this program example

The following command sequence illustrates the structure of the remote commands discussed in section Basic Remote Control Concepts. In particular it shows that:

- A trace can be created and handled without being displayed.

- Traces are referenced by trace names. The active trace of a channel is often referenced by the channel suffix.

- Diagram areas are referenced by a window suffix <Wnd>. An additional suffix <WndTr> in the DISPlay:WINDow<Wnd>:TRACe<WndTr>... commands numbers the different traces in a diagram area.

- In remote control, it is possible to display the same trace in several diagram areas.

- The analyzer provides several commands allowing a smooth transition between remote and manual control.

//

// 1. One channel, two traces, one diagram area

// Reset the instrument, creating the default trace Trc1 in channel 1.

// The default measured quantity is the forward transmission S-parameter S21.

// The default format is dB Mag.

*RST

//

// Create a second trace in channel 1, assign the format Phase,
// and display the new trace in the same diagram area.

CALCulate1:PARameter:SDEFine 'Trc2', 'S21' // the trace becomes the active trace but is not displayed

CALCulate1:FORMat PHASe // the trace is referenced by the channel suffix 1

DISPlay:WINDow1:TRACe2:FEED 'Trc2' // display the second trace, numbering it the second trace in diagram area no. 1

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

//

// 2. One channel, two traces, two diagram areas

// Create a second diagram area, assign Trc2 to the new area, and remove it from the first area.

DISPlay:WINDow2:STATe ON

DISPlay:WINDow2:TRACe2:FEED 'Trc2' // Trc2 is now displayed in both diagram areas

DISPlay:WINDow1:TRACe2:DELete

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

//

// 3. One channel, four traces, four diagram areas

// Reset the instrument, add diagram areas no. 2, 3, 4.

*RST; :DISPlay:WINDow2:STATe ON

DISPlay:WINDow3:STATe ON

DISPlay:WINDow4:STATe ON

//

// Assign the reflection parameter S11 to the default trace.

:CALCulate1:PARameter:MEASure 'Trc1', 'S11'

//

// Assign the remaining S-parameters to new traces Trc2, Trc3, Tr4;

// select the Smith chart format for the reflection parameters.

CALCulate1:FORMat SMITh // Smith chart for the active trace Trc1

CALCulate1:PARameter:SDEFine 'Trc2', 'S21'

CALCulate1:PARameter:SDEFine 'Trc3', 'S12'

CALCulate1:PARameter:SDEFine 'Trc4', 'S22'

CALCulate1:FORMat SMITh // Smith chart for the active trace Trc4, referenced by the channel number

//

// Display the new traces in diagram areas no. 2 to 4.

DISPlay:WINDow2:TRACe2:FEED 'Trc2'

DISPlay:WINDow3:TRACe3:FEED 'Trc3'

DISPlay:WINDow4:TRACe4:FEED 'Trc4'

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

// Check the result in the trace manager

// The trace manager gives an overview of the current channel/trace configuration

DISPlay:MENU:KEY:EXECute 'Trace Manager'

### Several Traces with Different Channel Settings...

Programming task: Create three channels with 3, 1 and 2 traces, respectively, and display the traces in two diagram areas.

Important remote control features for this program example

The following command sequence illustrates the structure of the remote commands discussed in section Basic Remote Control Concepts. In particular it shows that:

- Channels are always referenced by a channel suffix.

- Traces are referenced by trace names. The active trace of a channel is often referenced by the channel suffix.

- Diagram areas are referenced by a window suffix <Wnd>. An additional suffix <WndTr> in the DISPlay:WINDow<Wnd>:TRACe<WndTr>... commands numbers the different traces in a diagram area.

- The analyzer provides several commands allowing a smooth transition between remote and manual control.

//

// 1. Create all channels and traces

// Reset the instrument, creating the default trace Trc1 in channel 1.

// The default measured quantity is the forward transmission S-parameter S21.

// The default format is dB Mag.

*RST

//

// Create two more traces in channel 1, assigning a trace name and a measured quantity

// to each of them. Choose descriptive trace names (instead of the short default names used above).

CALCulate1:PARameter:SDEFine 'Impedance_trace', 'Z-S21' // the trace becomes the active trace for channel 1 but is not displayed

CALCulate1:PARameter:SDEFine 'Admittance_trace', 'Y-S21' // the trace becomes the active trace for channel 1

//

// Create channel 2 with one new trace, channel 3 with two new traces.

CALCulate2:PARameter:SDEFine 'Ratio_trace', 'B1/B2'

CALCulate3:PARameter:SDEFine 'Z_trace', 'Z21'

CALCulate3:PARameter:SDEFine 'Y_trace', 'Y21'

CALCulate3:PARameter:SELect 'Z_trace' // the trace created previously becomes the active trace for channel 3

// So far, only the default trace is displayed.

//

// Check the result in the trace manager

// The trace manager gives an overview of the current channel/trace configuration

DISPlay:MENU:KEY:EXECute 'Trace Manager'

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

//

// 2. Create second diagram area and display traces

DISPlay:WINDow2:STATe ON

DISPlay:WINDow1:TRACe2:FEED 'Admittance_trace'

DISPlay:WINDow1:TRACe3:FEED 'Y_trace'

DISPlay:WINDow2:TRACe1:FEED 'Impedance_trace'

DISPlay:WINDow2:TRACe2:FEED 'Ratio_trace'

DISPlay:WINDow2:TRACe3:FEED 'Z_trace'

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

//

// 3. Check and modify your configuration

// Query the traces in channel 1.

CALCulate1:PARameter:CATalog?

// The response is 'Trc1,S21,Impedance_trace,Z-S21,Admittance_trace,Y-S21'

//

// Query the reference level for the 'Z_trace'.

// The trace is referenced by its number in diagram area no. 2.

DISPlay:WINDow2:TRACe3:Y:RLEVel?

//

// Change the display format for the 'Z_trace'. The trace is the active trace in channel 3,
// so it is referenced by the channel suffix 3.

CALCulate3:FORMat PHASe

## Markers and Limit Lines...

Programming task: Display two traces in a single diagram ares, use markers to read results, and perform a limit check.

Important remote control features for this program example

The following command sequence illustrates the structure of the remote commands discussed in section Basic Remote Control Concepts. In particular it shows that:

- Traces are referenced by trace names. The active trace of a channel is often referenced by the channel suffix. This simplifies the program syntax, e.g. in the commands for marker settings and for the limit check.

- Diagram areas are referenced by a window suffix <Wnd>. An additional suffix <WndTr> in the DISPlay:WINDow<Wnd>:TRACe<WndTr>... commands numbers the different traces in a diagram area.

- The analyzer provides several commands allowing a smooth transition between remote and manual control.

//

//

// 1. Create one channel, two traces, one diagram area

// Reset the instrument, creating the default trace Trc1 in channel 1.

// The default measured quantity is the forward transmission S-parameter S21.

// The default format is dB Mag.

*RST

//

// Create a second trace in channel 1, assign the format Phase,
// and display the new trace in the same diagram area.

CALCulate1:PARameter:SDEFine 'Trc2', 'S21' // the trace becomes the active trace but is not displayed

CALCulate1:FORMat PHASe // the trace is referenced by the channel suffix 1

DISPlay:WINDow1:TRACe2:FEED 'Trc2' // display the second trace, numbering it the second trace in diagram area no. 1

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

//

// 2. Marker settings

// Adjust the sweep range to consider an interesting segment of the trace and re-scale the diagram.

SENSe1:FREQuency:STARt 4.5 GHz; STOP 5.5 GHz

DISPlay:WINDow1:TRACe1:Y:SCALe:AUTO ONCE / in the autoscale command the trace is referenced by its number in the diagram

//

// Select trace Trc1 as the active trace of the channel, define a reference marker and a delta marker.

// In the marker commands the active trace is referenced by the channel suffix.

CALCulate1:PARameter:SELect 'Trc1'

CALCulate1:MARKer1:STATe ON // the marker is set to the center of the sweep range

CALCulate1:MARKer1:DELTa:STATe ON // this command also creates the reference marker

CALCulate1:MARKer1:REFerence:X 4.5 GHz // set the reference marker to the beginning of the sweep range

//

// Use the delta marker to search for the minimum of the trace and query the result.

CALCulate1:MARKer1:FUNCtion:EXECute MIN; RES? // the query returns the stimulus and the response value at the marker position

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

Use the CALCulate<Chn>:DATA... commands to retrieve the complete trace; see Retrieving Measurement Results
.

//

//

// 2. Limit lines and limit check

// Remove all markers and define a limit line for the active trace.

CALCulate1:MARKer1:AOFF

CALCulate1:LIMit:DATA 1, 4500000000, 5500000000, -5, -5 // define an upper limit line across the entire sweep range

CALCulate1:LIMit:DATA 2, 4500000000, 5000000000, -10, -15

CALCulate1:LIMit:DATA 2, 5000000000, 5500000000, -15, -10 // define two segments for the lower limit line

//

// Display the limit line and perform the limit check.

CALCulate1:LIMit:DISPlay:STATe ON

CALCulate1:LIMit:STATe ON; FAIL? / if the trace is failed; the response is 1.

//

// Check the result on the local screen

// Go to local

SYSTem:DISPlay:UPDate ONCE

//

// Check the result in the Define Limit Line dialog

// The Define Limit Line dialog gives an overview of the limit line segments of the active trace.

DISPlay:MENU:KEY:EXECute 'Define Limit Line'